package LC;

class TreeNode {
    int val ;
    TreeNode left = null;
    TreeNode right = null;
    public TreeNode(int val) { this.val = val; }
}

public class LC01 {
    public int run(TreeNode root) {
        // write code here
        if(root==null) return 0;
        if(root.left==null&&root.right!=null) return run(root.right)+1;
        if(root.right==null&&root.left!=null) return run(root.left)+1;
        return Math.min(run(root.left),run(root.right))+1;
    }
}